﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EBA.Data
{
    public abstract class EntityKeyMonitorBase<T> : IEntityKeyMonitor
    {
        public void AddEventListeners<TEntity>(EntityKeyChangeTracker<TEntity> changeTracker)
        {
            var tracker = changeTracker as EntityKeyChangeTracker<T>;
            if (tracker != null)
            {
                tracker.EntityKeyDeleting += EntityKeyDeleting;
                tracker.EntityKeysDeleting += EntityKeysDeleting;
            }
        }

        protected abstract void EntityKeysDeleting(IUnitOfWork context, IQuery<T> query, System.Linq.Expressions.Expression<Func<T, bool>> filter);
        protected abstract void EntityKeyDeleting(IUnitOfWork context, object key);
    }
}
